home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / BEZIER.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-07  |  3.3 KB  |  103 lines

  1. /****************************************************************************
  2. *                   bezier.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for BEZIER.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24.  
  25. #ifndef BEZIER_H
  26. #define BEZIER_H
  27.  
  28.  
  29.  
  30. /*****************************************************************************
  31. * Global preprocessor defines
  32. ******************************************************************************/
  33.  
  34. #define BICUBIC_PATCH_OBJECT (PATCH_OBJECT+DOUBLE_ILLUMINATE)
  35.  
  36. #define BEZIER_INTERIOR_NODE 0
  37. #define BEZIER_LEAF_NODE 1
  38.  
  39. #define MAX_PATCH_TYPE 4
  40.  
  41.  
  42.  
  43.  
  44. /*****************************************************************************
  45. * Global typedefs
  46. ******************************************************************************/
  47.  
  48. typedef struct Bicubic_Patch_Struct BICUBIC_PATCH;
  49. typedef struct Bezier_Node_Struct BEZIER_NODE;
  50. typedef struct Bezier_Child_Struct BEZIER_CHILDREN;
  51. typedef struct Bezier_Vertices_Struct BEZIER_VERTICES;
  52.  
  53. struct Bezier_Child_Struct
  54. {
  55.   BEZIER_NODE *Children[4];
  56. };
  57.  
  58. struct Bezier_Vertices_Struct
  59. {
  60.   float uvbnds[4];
  61.   VECTOR Vertices[4];
  62. };
  63.  
  64. struct Bezier_Node_Struct
  65. {
  66.   int Node_Type;      /* Is this an interior node, or a leaf */
  67.   VECTOR Center;      /* Center of sphere bounding the (sub)patch */
  68.   DBL Radius_Squared; /* Radius of bounding sphere (squared) */
  69.   int Count;          /* # of subpatches associated with this node */
  70.   void *Data_Ptr;     /* Either pointer to vertices or pointer to children */
  71. };
  72.  
  73. struct Bicubic_Patch_Struct
  74. {
  75.   OBJECT_FIELDS
  76.   int Patch_Type, U_Steps, V_Steps;
  77.   VECTOR Control_Points[4][4];
  78.   VECTOR Bounding_Sphere_Center;
  79.   DBL Bounding_Sphere_Radius;
  80.   DBL Flatness_Value;
  81.   BEZIER_NODE *Node_Tree;
  82. };
  83.  
  84.  
  85.  
  86. /*****************************************************************************
  87. * Global variables
  88. ******************************************************************************/
  89.  
  90.  
  91.  
  92. /*****************************************************************************
  93. * Global functions
  94. ******************************************************************************/
  95.  
  96. void Precompute_Patch_Values PARAMS((BICUBIC_PATCH *Shape));
  97. BICUBIC_PATCH *Create_Bicubic_Patch PARAMS((void));
  98. void Compute_Bicubic_Patch_BBox PARAMS((BICUBIC_PATCH *Patch));
  99.  
  100.  
  101.  
  102. #endif
  103.